<%-- 
    Document   : category
    Created on : Mar 26, 2013, 3:51:08 PM
    Author     : duonghung1369
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib tagdir="/WEB-INF/tags/common_admin/" prefix="common" %>
<%@taglib uri="/struts-tags" prefix="s" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>

<!DOCTYPE HTM>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Administrator Page</title>
        <link rel="stylesheet" type="text/css" href="../resource/css/admin_style.css">
        <link rel="stylesheet" type="text/css" href="../resource/css/popup.css">
        <script src="../resource/js/ajaxfunctions.js" type="text/javascript" ></script>
        <script src="../resource/js/adminfunctions.js" type="text/javascript" ></script>
    </head>
    <body>
        <div class="admin-container">
            <common:header />
            <div class="leftColumn">
                <h2>Menu</h2>
                <div class="box sidemenu" style="height: 982px;">
                    <common:navigation />
                </div>
            </div>
            <div class="rightColumn">
                <div class="boxa round first grid">
                    <h2>Category Management</h2>

                    <a href="#add-new-category-form" style="text-decoration:none" class="custom-button" >Add Category</a>
                    <c:import charEncoding="UTF-8" var="xsldoc" url="/WEB-INF/xsl/categories.xsl" />
                    <c:import charEncoding="UTF-8" var="xmldoc" url="/WEB-INF/xml/categories.xml"/>
                    <x:transform  xml="${xmldoc}" xslt="${xsldoc}" />

                    <!-- add new category form -->
                    <div style="margin-top: 50px;">
                        <form name="newCategoryForm" method="POST" onsubmit="return false;">

                            <a href="#x" class="overlay" id="add-new-category-form"></a>
                            <div class="popup">
                                <h2 style="color: blue">Add new category</h2>
                                <table border="0" cellspacing="20">
                                    <tbody>
                                        <tr>
                                            <td>Name</td>
                                            <td><input type="text" name="categoryName" title="Please fill out category name!" placeholder="Category name..." maxlength="50" required /></td>
                                        </tr>
                                        <tr>
                                            <td>Parent</td>
                                            <td>
                                                <x:parse var="doc" xml="${xmldoc}" />
                                                <select name="parentId" id="new-category-listbox">
                                                    <option value="-1">---------------</option>
                                                    <!--                                                    select="$doc//category[not(parent)]" var="cate"-->
                                                    <x:forEach select="$doc//category[not(parent)]" var="cate">
                                                            <option value="<x:out select="$cate/@id" />"><x:out select="$cate/name"/></option>
                                                        
                                                    </x:forEach>
                                                </select>

                                            </td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td>
                                                <input type="submit" value="Add" class="custom-button" onclick="addNewCategoryAjax();" />
                                                <input type="reset" value="Reset" class="custom-button" />
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <a class="close" href="#close" id="close-add-new-category-form"></a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="clear">
        </div>
        <common:footer />
    </body>
</html>